// This is file defines several routines for signal processing
#ifndef SIGNAL_PROCESSING_H
#define SIGNAL_PROCESSING_H

#include "fftw3.h"

// PSD using covariance method
void pcov(double *oFreq,double *oPower,double *iTime, double *iSignalVal);
// Pseudospectrum using eigenvector method 
void peig(double *oFreq,double *oPower,double *iTime, double *iSignalVal);
// Cross-correlation
void xcorr(double *oFreq,double *oCorrVal,double *iTime, double *SignalVal);
// Cross-covariance
void xcov(doubel *oFreq,double *oCovVal,double *iTime,double *SignalVal);

// Enumeration of supported estimation methods
enum EstMethod{
	COV,
	BURG,
	EIGV
};
// Window types supported
enum WindowName{
	Rectangular
};

class spectrum{
	double fs; // Sampling frequency
	int NFFT; // Number of point in FFT
	EstMethod est_method;
	WindowName window_name;
	double *Frequency;
	double *Values;

	void cov(double *iTime,double *Signal,int N);
public:	
	spectrum(EstMethod iEstMethod,int iNFFT);
	
	void setEstMethod(EstMethod iEstMethod);
	string getEstMethod();
	EstMethod getEstMethod();
	
	void setNFFT(int iNFFT);
	int  getNFFT();
	
	void estimate(double *iTime,double *iSignal,int N);
};

#endif